using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.IO;

namespace Cafechess.Chess.Engines
{
  public class Factory
  {
    public static ChessEngines LoadConfig(string filename)
    {     
      ChessEngines chessInterface = null;
      StreamReader reader = null;
      try
      {
        XmlSerializer serializer = new XmlSerializer(typeof(ChessEngines));
        reader = new StreamReader(filename);
        chessInterface = (ChessEngines)serializer.Deserialize(reader);
      }
      catch (Exception myException)
      {
        myException.ToString();
      }
      finally
      {
        if (reader != null)
          reader.Close();
      }
      return chessInterface;
    }
  }
}
